<template>
    <div class="container">
<van-nav-bar
  title="每日头条"
  right-text="搜索"
  @click-right="$router.push('/search')"
  v-if="$route.path!=='/user'"
/>
 <div class="my-wrapper" :class="{noTop:$route.path==='/user'}">
  <!-- ===============在这里是加缓存 -->
    <keep-alive >
      <router-view v-if="$route.meta.keepAlive"></router-view>
    </keep-alive>

      <router-view v-if="!$route.meta.keepAlive"></router-view>
</div>

<van-tabbar :value="active" route>
      <van-tabbar-item name="/" to="/" icon="home-o">首页</van-tabbar-item>
      <van-tabbar-item name="/question" to="/question"  icon="chat-o">问答</van-tabbar-item>
      <van-tabbar-item name="/media" to="/video"  icon="video-o">视频</van-tabbar-item>
      <van-tabbar-item name="/user" to="/user"  icon="user-o">我的</van-tabbar-item>
    </van-tabbar>
    </div>
</template>

<script>
export default {
  data () {
    return {
      active: '/'
    }
  }
}
</script>

<style  scoped lang="less">
.container{
  width: 100%;
  height: 100%;
  position: relative;
 .my-wrapper{
    width: 100%;
    height: 100%;
    overflow: hidden;
    // padding-top: 46px;
    // padding-bottom: 50px;
    box-sizing: border-box;
    &.noTop{
      padding-top: 0;
    }
  }
}
</style>
